<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="css/style.css" />
<!--[if IE 6]>
    <script src="js/iepng.js" type="text/javascript"></script>
        <script type="text/javascript">
           EvPNG.fix('div, ul, img, li, input, a'); 
        </script>
    <![endif]-->
<script type="text/javascript" src="js/jquery-1.11.1.min_044d0927.js"></script>
<script type="text/javascript" src="js/jquery.bxslider_e88acd1b.js"></script>

<script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="js/menu.js"></script>

<script type="text/javascript" src="js/select.js"></script>

<script type="text/javascript" src="js/lrscroll.js"></script>

<script type="text/javascript" src="js/iban.js"></script>
<script type="text/javascript" src="js/fban.js"></script>
<script type="text/javascript" src="js/f_ban.js"></script>
<script type="text/javascript" src="js/mban.js"></script>
<script type="text/javascript" src="js/bban.js"></script>
<script type="text/javascript" src="js/hban.js"></script>
<script type="text/javascript" src="js/tban.js"></script>

<script type="text/javascript" src="js/lrscroll_1.js"></script>


<title>注册</title>
</head>
<body>
	<!--Begin Header Begin-->
	<div class="soubg">
		<div class="sou">
			<span class="fr"> <span class="fl">你好，请<a
					href="Login.html">登录</a>&nbsp; <a href="Regist.html"
					style="color: #ff4e00;">免费注册</a>&nbsp;
			</span> <span class="fl">|&nbsp;关注我们：</span> <span class="s_sh"><a
					href="#" class="sh1">新浪</a><a href="#" class="sh2">微信</a></span> <span
				class="fr">|&nbsp;<a href="#">手机版&nbsp;<img
						src="images/s_tel.png" align="absmiddle"/></a></span>
			</span>
		</div>
	</div>
	<!--End Header End-->
	<!--Begin Login Begin-->
	<div class="log_bg">
		<div class="top">
			<div class="logo">
				<a href="Index.html"><img src="images/2.png" /></a>
			</div>
		</div>
		<div class="regist">
			<div class="log_img">
				<img src="images/l_img.png" width="611" height="425" />
			</div>
			<div class="reg_c">
				<!--   -->
				<form action="registUser" method="post" id="formid">
					<table border="0"
						style="width: 420px; font-size: 14px; margin-top: 20px;"
						cellspacing="0" cellpadding="0">
						<tr height="50" valign="top">
							<td width="95">&nbsp;</td>
							<td><span class="fl" style="font-size: 24px;">注册</span><span
								class="fr">已有商城账号，<a href="Login.html"
									style="color: #ff4e00;">我要登录</a></span></td>
						</tr>
						<tr height="50">
							<td align="right">用户昵称 &nbsp;</td>
							<td><input type="text" id="userNickName" name="uNick"
								value="" class="l_mem" onblur="checkNickname()" /> <span
								id="nickname_span"></span></td>
						</tr>
						<tr height="50">
							<td align="right"><font color="#ff4e00">*</font>&nbsp;用户名
								&nbsp;</td>
							<td><input type="text" name="uName" id="userName"
								value="" class="l_user" onblur="checkname()" /> <span
								id="username_span"></span></td>
						</tr>
						<tr height="50">
							<td align="right"><font color="#ff4e00">*</font>&nbsp;密码
								&nbsp;</td>
							<td><input type="password" name="uPwd" id="userPwd"
								value="" class="l_pwd" onblur="checkPassword()" /><span
								id="userpwd_span"></span></td>
						</tr>
						<tr height="50">
							<td align="right"><font color="#ff4e00">*</font>&nbsp;确认密码
								&nbsp;</td>
							<td><input type="password" value="" id="reuserPwd"
								class="l_pwd" onblur="checkRepassword() " /> <span
								id="reuserpwd_span"></span></td>
						</tr>
						<tr height="50">
							<td align="right"><font color="#ff4e00">*</font>&nbsp;邮箱
								&nbsp;</td>
							<td><input type="text" name="uEmail" id="userEmail"
								value="" class="l_email" onblur="checkEmail()" /><span
								id="useremail_span"></span></td>
						</tr>
						<tr height="50">
							<td align="right"><font color="#ff4e00">*</font>&nbsp;手机
								&nbsp;</td>
							<td><input type="text" name="uTel" id="userTel" value=""
								class="l_tel" onblur="isPoneAvailable()" /> <span
								id="usertel_span"></span></td>
						</tr>
						<!--  <tr height="50">
                <td align="right">邀请人ID号 &nbsp;</td>
                <td><input type="text" value="" class="l_num" /></td>
              </tr>  -->
						<!--    <tr height="50">
                <td align="right"> <font color="#ff4e00">*</font>&nbsp;验证码 &nbsp;</td>
                <td>
                    <input type="text" value="" class="l_ipt" />
                    <a href="#" style="font-size:12px; font-family:'宋体';">换一张</a>
                </td>
              </tr> -->
						<tr>
							<td>&nbsp;</td>
							<td style="font-size: 12px; padding-top: 20px;"><span
								style="font-family: '宋体';" class="fl"> <label
									class="r_rad"><input type="checkbox" checked="checked" />
								</label> <label class="r_txt">我已阅读并接受《用户协议》 </label>
							</span></td>
						</tr>
						<tr height="60">
							<td>&nbsp;</td>
							<td><input type="button" value="立即注册" class="log_btn"
								onclick="submitForm()" /></td>
						</tr>
					</table>
				</form>
			</div>
		</div>
	</div>
	<!--End Login End-->
	<!--Begin Footer Begin-->
	<div class="btmbg">
		<div class="btm">
			备案/许可证编号：蜀ICP备12009302号-1-www.dingguagua.com Copyright © 2015-2018
			尤洪商城网 All Rights Reserved. 复制必究 , Technical Support: Dgg Group <br />
			<img src="images/b_1.gif" width="98" height="33" /><img
				src="images/b_2.gif" width="98" height="33" /><img
				src="images/b_3.gif" width="98" height="33" /><img
				src="images/b_4.gif" width="98" height="33" /><img
				src="images/b_5.gif" width="98" height="33" /><img
				src="images/b_6.gif" width="98" height="33" />
		</div>
	</div>
	<script type="text/javascript">
		
			//1.用户名处理
			//进行用户名的正则判断
			function checkname() {				
				//javascript所有的变量都是以var定义的
				//javascript的变量属于弱类型
				//获取用户输入的用户名	
				
				
				var name = document.getElementById("userName").value;
				//去除字符串两端空格	
				name = name.trim();
				//判断是否为空	
				if (name == "") 
				{
					$("username_span").html("用户名不为空")
					document.getElementById("username_span").innerHTML = "用户名不能为空";
					document.getElementById("userName").value="";
				} 
				else if (name.length<6||name.length>16)
				{
					document.getElementById("username_span").innerHTML = "用户名的长度为6-16位";
					document.getElementById("userName").value="";
				} 
				else {
					document.getElementById("username_span").innerHTML = "";
					//校验用户名是否存在		
					//使用ajax异步校验用户名		
					$.ajax({
								url : "checkUserName",
								type : "post",
								data : {
									"username" : name
								},
								//json数据格式的用户名从jsp传递给controller			
								dataType : "json",
								async : false,
								//让ajax执行代码顺序同步			
								success : function(data) {
									if (data.msg == "false") {
										document.getElementById("username_span").innerHTML = "用户名已存在";
									} else {
										document.getElementById("username_span").innerHTML = "用户名可用";
									
									}
								}
							});
				}
			
			}
			//2.邮箱处理
			//进行邮箱正则判断 
			function checkEmail() {
				var email = document.getElementById("userEmail").value;
				var reg = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/;
				var f = reg.test(email);
				if (f == false) {
					document.getElementById("useremail_span").innerHTML = "邮箱格式错误";
					document.getElementById("userEmail").value="";
				} 
				else {
					document.getElementById("useremail_span").innerHTML = "";				
					//校验邮箱是否存在		
					//使用ajax异步校验邮箱		
					$.ajax({
								url : "checkUserEmail",
								type : "post",
								data : {
									"userEmail" : email
								},
								//json数据格式的用户名从jsp传递给controller			
								dataType : "json",
								async : false,
								//让ajax执行代码顺序同步			
								success : function(data) {
									if (data.msg == "false") 
									{
										document.getElementById("useremail_span").innerHTML = "邮箱已存在";
									} 
									else
									{
										document.getElementById("useremail_span").innerHTML = "邮箱可用";
									
									}
								}
							});
				    }
			}
			//3.手机号处理
			//进行手机号正则处理
          //验证手机号码格式
			
			 function isPoneAvailable(){
			 　
				var phonenumber = document.getElementById("userTel").value;　
			 var myreg=/^[1][3,4,5,7,8][0-9]{9}$/; 
			 　
			  if (!myreg.test(phonenumber))
			 { 
				 document.getElementById("usertel_span").innerHTML = "请输入正确的手机号格式";
				 document.getElementById("userTel").value="";
			 　
			}
			 else {		 　　
				document.getElementById("usertel_span").innerHTML = "";				
				//校验手机是否存在		
				//使用ajax异步校验手机		
				$.ajax({
							url : "checkUserTel",
							type : "post",
							data : {
								"userTel" : phonenumber
							},
							//json数据格式的用户名从jsp传递给controller			
							dataType : "json",
							async : false,
							//让ajax执行代码顺序同步			
							success : function(data) {
								if (data.msg == "false") 
								{
									document.getElementById("usertel_span").innerHTML = "手机已存在";
								} 
								else
								{
									document.getElementById("usertel_span").innerHTML = "手机可用";
								
								}
							}
						});
			 　}
			
			}
			
			//4.1密码格式的确认
			function checkPassword() {
				var password = document.getElementById("userPwd").value;
				var reg = /^[a-zA-Z]\w{5,15}$/;
				var f = reg.test(password);
				if (f == false) {
					document.getElementById("userpwd_span").innerHTML = "密码格式错误";
					document.getElementById("userPwd").value="";
				} 
				else 
				{
					document.getElementById("userpwd_span").innerHTML = "";	
				}
			}

			//4.2确认密码
			function checkRepassword() 
			{
				var password = document.getElementById("userPwd").value;
				var repassword = document.getElementById("reuserPwd").value;
				if (password == repassword) {
					document.getElementById("reuserpwd_span").innerHTML = "";	
			} 
				else
			{
					document.getElementById("reuserpwd_span").innerHTML = "两次输入密码不一致";
					document.getElementById("reuserPwd").value="";
			}
			}        
			//6.用户昵称格式确认
			function checkNickname() {
				var nickname = document.getElementById("userNickName").value;
				var reg = /^[\u4e00-\u9fa5]{2,6}$/
				var f = reg.test(nickname);
				if (f == false) {
					document.getElementById("nickname_span").innerHTML = "昵称格式错误";
				    document.getElementById("userNickName").value="";
				} else {
					document.getElementById("nickname_span").innerHTML = "";
					
				}
			}
			//6当以上全部满足 提交 表单 到进行用户的注册
		      function	submitForm()
			{
		    	  console.log("1111");
				//获取所有值判断值是否为空 如果不为空就进行提交
		    	  var name = document.getElementById("userName").value;
		    	  var email = document.getElementById("userEmail").value;
		    	 　var phonenumber = document.getElementById("userTel").value;　
		    	 var password = document.getElementById("userPwd").value;
		    	 var repassword = document.getElementById("reuserPwd").value;
		    	 var nickname = document.getElementById("userNickName").value;
		    		console.log(name);
		    	 if(name!=null&&email!=null&&phonenumber!=null&&password!=null&&repassword!=null&&nickname!=null)
		    	 {
		    		 document.getElementById("formid").submit();
		    	 }
			}
            
	
	</script>
</body>



</html>
